# -*- coding: utf-8 -*-
"""
Author:LeoDuan
Date: 2023/3/23 21:59
"""
import json
from kafka import KafkaProducer

producer = KafkaProducer(
    value_serializer=lambda v: json.dumps(v).encode("utf-8"),
    bootstrap_servers=["192.168.136.129:9092"]
)

msf_dict = {
    "operatorId": "test",  # 公交公司ID
    "terminalId": "123",  # 设备Id
    "terminalCode": "123",  # 设备编码（使用车辆ID）
    "terminalNo": "1",  # 同一车辆内terminal序号从1开始
}

producer.send("text1", msf_dict)
producer.close()
